<?php
class Response {
	private $__config, $__apiconfig;
	private $player;
	function __construct($config){
		$this->__config = &$config;
		$this->__apiconfig = $this->__config->get('API')->get('APIPLAYER');
		$this->player = (isset($_GET['p']) && $_GET['p'] != '')?$_GET['p']:'';
		
	}
	
	function __destruct(){
		
	}
	
	public function toString(){
		if (!$this->__apiconfig->get('APIACCES')){
			return 'ACCESSDENIED';
		}
		
		$script ="";
		if ($this->player =="FLASH"){
			$script = 'jwplayer("videoBox").setup({
					flashplayer: "lib/video/FLASH/player.swf",
					file: "'.$_GET['url'].'",
					height: 100%,
					width: 100%
					});';
		} else {
			$script = 'var cnt = document.getElementById("videoBox");
				var src = "lib/video/MP/wmvplayer.xaml";
				var cfg = {
					file:"'.$_GET['url'].'",
					image:"images/app/background.png",
					height:"100%",
					width:"100%"
				};
				var ply = new jeroenwijering.Player(cnt,src,cfg);';
		}
		$html = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script type="text/javascript" src="lib/video/FLASH/jwplayer.js"></script>
<script type="text/javascript" src="lib/video/MP/silverlight.js"></script>
<script type="text/javascript" src="lib/video/MP/wmvplayer.js"></script>

</head>

<body style="margin: 0; background-image: url(\'images/app/background.png\')">
<div id="videoBox"></div>
<script type="text/javascript">
	'.$script.'
</script>

<script language="javascript" type="text/javascript">
		function checkSize(){
		   var sshowcase = $j("#videoBox");
		   h = $j(window).height();
		   sshowcase.css("height", h+"px");
		   window.onresize = checkSize;
		}
		checkSize();
	</script>
</body>

</html>';
		return $html;
	}
}
?>
